package com.sf.asp.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sf.asp.entity.User;
import com.sf.asp.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class LoginController {

    private final UserService userService;

    public LoginController(UserService userService){
        this.userService = userService;
    }


    @GetMapping("/login")
    public String loginPage(){
        return "login";
    }


    /**
     * 返回首页
     * @return 首页视图
     */
    @GetMapping("/front")
    public String frontPage(){
        return "manage/front-page";
    }


    @PostMapping("/login")
    @ResponseBody
    public String login(String username,String password){
        LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(User::getUsername,username).eq(User::getPassword,password);
        return "";
    }

}
